package com.viphome.controller;

import com.viphome.GirlProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * Created by wangzhanjin on 2017/12/23.
 */
@RestController
public class HelloController {

//    @Value("${cupSize}")
//    private String cupSize;
//
//    @Value("${age}")
//    private Integer age;

//    @Value("${content}")
//    private String content;

    @Autowired
    private GirlProperties girlProperties;


    @RequestMapping(value = {"/hello1","hi"})
    public String hello1(){
//        return "Hello Spring Boot"+cupSize+"罩杯"+age+"内容是："+girlProperties.getCupSeize();
        return "Hello Spring Boot"+girlProperties.getCupSize();
    }

    @RequestMapping(value = "/hello2")
    public String hello2(){
        return "index";
    }

    @RequestMapping(value = "/hello3/{id}")
    public String hello3(@PathVariable("id") Integer id){
        return "id:"+id;
    }

//    @RequestMapping(value = "/hello4",method = RequestMethod.GET)
    @GetMapping(value = "/hello4")
    //required是否必传,defaultValue默认字符串
    public String hello4(@RequestParam(value="id",required = false,defaultValue = "0") Integer id){
        return "id:"+id;
    }
}
